home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / JForth / JTools / Demos / demo_polygon < prev    next >
Encoding:
Text File  |  1991-08-14  |  789 b   |  56 lines

  1. \ Demonstrate the drawing of polygons using the area routines.
  2. \
  3. \ Author: Phil Burk
  4. \ Copyright 1987
  5. include? gr.init ju:amiga_graph
  6. include? ?closebox ju:amiga_events
  7. include? gr.area.init ju:polygon
  8. include? choose ju:random
  9.  
  10. ANEW TASK-DEMO_POLYGON
  11.  
  12. : PG.INIT
  13.     gr.init
  14.     gr.opentest
  15.     gr.area.init
  16. ;
  17.  
  18. : PG.TERM
  19.     gr.area.term
  20.     gr.closecurw
  21.     gr.term
  22. ;
  23.  
  24. : PG.TEST.MANY  ( N -- )
  25.     0 DO
  26.         10 10   20 40   30 15 gr.triangle
  27.         i 3 and gr.color!
  28.     LOOP
  29. ;
  30.  
  31. : PG.RANDOM.POLY ( N_vertices -- )
  32.     600 choose 180 choose gr.areamove
  33.     0 DO
  34.         600 choose 180 choose gr.areadraw
  35.     LOOP
  36.     gr.areaend
  37. ;
  38.  
  39. : PG.FUN ( N -- )
  40.     0 DO
  41.         10 choose 2 + pg.random.poly
  42.         i 3 and gr.color!
  43.     LOOP
  44. ;
  45.  
  46. : DEMO.POLYGON ( -- )
  47.     pg.init
  48.     BEGIN 50 pg.fun
  49.         ?closebox
  50.     UNTIL
  51.     pg.term
  52. ;
  53.  
  54. cr ." Enter:  DEMO.POLYGON    for demo!" cr
  55.  
  56.